package android.cst.hqu.edu.cn.basemvp.mvp.Base;

import android.app.Activity;
import android.cst.hqu.edu.cn.basemvp.mvp.Base.BasePresenter;
import android.os.Bundle;
import android.support.annotation.Nullable;

public abstract class BaseActivity<V, P extends BasePresenter<V>> extends Activity {
    private P mPresenter;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mPresenter=createPresenter();
        mPresenter.attachView((V) this);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mPresenter.detachView();
    }
    protected abstract P createPresenter();
    protected P getPresenter(){
        return mPresenter;
    }
}